const Koa = require("koa");

const app = new Koa();

app.use((ctx, next) => {
  // 设置状态码
  ctx.status = 200;

  // 返回对象
  ctx.body = {
    name: "coderwhy",
    age: 18,
    avatar_url: "http://aaa.png",
  };

  // 返回数组
  // ctx.body = ["aaa", "bbb", "ccc"];
});

app.listen(8000, () => {
  console.log("Koa初体验服务器启动成功");
});
